/***********************************************************************/
/*                                                                     */
/*  FILE        :intprg.c                                              */
/*  DATE        :Fri, Jan 17, 2014                                     */
/*  DESCRIPTION :define the top address of the interrupt vectors.      */
/*  CPU GROUP   :64                                                    */
/*                                                                     */
/*  This file is generated by Renesas Project Generator (Ver.4.19).    */
/*  NOTE:THIS IS A TYPICAL EXAMPLE.                                    */
/***********************************************************************/

/***************************************************************************
* COMPILER for M16C/60
* Copyright (C) 2004 (2010) Renesas Electronics Corporation.
* and Renesas Solutions Corporation. All rights reserved.
* intprg.c : define variable vector table for M16C/65
*
*
* $Date: 2008/01/08 10:10:09 $
* $Revision: 1.2 $
**************************************************************************/
#include "sfr64.h"
#include "cstartdef.h"
#include "SysConfig.h"
#include "Power.h"

#ifdef  AV_CONTROLLER
#include "AVController.h"
#endif

unsigned char Timer_1sec;
extern unsigned char ucTask_Timer5msec;
#ifdef  HW_SERIAL
extern void DRV_LC786XXX_SerialInterrupt(void);
#endif

#ifdef  MOVON
extern void MV_TX_Int(void);
extern void MV_RX_Int(void);
#endif
#ifdef  ST7565P
extern void ST7565_SerialTX_Interrupt(void);
extern void ST7565_DMA0_Interrupt(void);
#endif
#ifdef  SERIAL_FLASH
extern void SF_Receive_Int(void);
extern void SF_Send_Int(void);
#endif

#pragma interrupt	_brk(vect=0)
void _brk(void);
void _brk(void){}

// vector 1 reserved

// INT7				(software int 2)
#pragma interrupt	_int7(vect=2)
void _int7(void);
void _int7(void){}

// INT6				(software int 3)
#pragma interrupt	_int6(vect=3)
void _int6(void);
void _int6(void){}

// INT3				(software int 4)
#pragma interrupt	_int3(vect=4)
void _int3(void);
void _int3(void){}

// TIMER B5			(software int 5)
#pragma interrupt	_timer_b5(vect=5)
void _timer_b5(void);
void _timer_b5(void){}

// TIMER B4,UART1 bus collision (software int 6)
// The sp condition detection
#pragma interrupt	_timer_b4(vect=6)
void _timer_b4(void);
void _timer_b4(void){}

// TIMER B3,UART0 bus collision (software int 7)
// The sp condition detection
#pragma interrupt	_timer_b3(vect=7)
void _timer_b3(void);
void _timer_b3(void){}

// SI/O4 or INT5		(software int 8)
#pragma interrupt	_int5(vect=8)
void _int5(void);
#ifdef  HW_SERIAL
void _int5(void){DRV_LC786XXX_SerialInterrupt();}
#else
void _int5(void){}
#endif

// SI/O3 or INT4		(software int 9)
#pragma interrupt	_int4(vect=9)
void _int4(void);
void _int4(void){}

// UART2 Bus Collision		(software int 10)
#pragma interrupt	_uart2_bus_collision(vect=10)
void _uart2_bus_collision(void);
void _uart2_bus_collision(void){}

// DMA0				(software int 11)
#pragma interrupt	_dma0(vect=11)
void _dma0(void);
void _dma0(void)
{
	#ifdef  ST7565P
	ST7565_DMA0_Interrupt();
	#endif
}

// DMA1				(software int 12)
#pragma interrupt	_dma1(vect=12)
void _dma1(void);
void _dma1(void){}

// input key			(software int 13)
#pragma interrupt	_input_key(vect=13)
void _input_key(void);
void _input_key(void){}

// A-D				(software int 14)
#pragma interrupt	_ad_converter(vect=14)
void _ad_converter(void);
void _ad_converter(void){}

// uart2 transmit/NACK2		(software int 15)
#pragma interrupt	_uart2_transmit(vect=15)
void _uart2_transmit(void);
void _uart2_transmit(void)
{
	#ifdef  ST7565P
	ST7565_SerialTX_Interrupt();
	#endif
}

// uart2 receive/ACK2		(software int 16)
#pragma interrupt	_uart2_receive(vect=16)
void _uart2_receive(void);
void _uart2_receive(void){}

#if __STANDARD_IO__ == 0
// uart0 transmit		(software int 17)
#pragma interrupt	_uart0_transmit(vect=17)
void _uart0_transmit(void);
#ifdef  MOVON
void _uart0_transmit(void)
{
	MV_TX_Int();
}
#else
void _uart0_transmit(void){
}
#endif
#else
#if (defined(__FOUSB__) || defined(__E8__))
// uart0 can't be used
#else
// uart0 transmit		(software int 17)
#pragma interrupt	_uart0_transmit(vect=17)
void _uart0_transmit(void);
#ifdef  MOVON
void _uart0_transmit(void)
{
	MV_TX_Int();
}
#else
void _uart0_transmit(void){}eeretre
#endif
#endif
#endif

// uart0 receive		(software int 18)
#pragma interrupt	_uart0_receive(vect=18)
void _uart0_receive(void);
#ifdef  MOVON
void _uart0_receive(void)
{
	MV_RX_Int();
}
#else
void _uart0_receive(void){}
#endif

#if __STANDARD_IO__ == 1
// uart1 can't be used
#else
#if defined(__FOUSB__) || defined(__E8__)
// uart1 can't be used
#else
// uart1 transmit		(software int 19)
#pragma interrupt	_uart1_transmit(vect=19)
void _uart1_transmit(void);
void _uart1_transmit(void){}
#endif
#endif

// uart1 receive		(software int 20)
#pragma interrupt	_uart1_receive(vect=20)
void _uart1_receive(void);
void _uart1_receive(void){}

// TIMER A0			(software int 21)
#pragma interrupt	_timer_a0(vect=21)
void _timer_a0(void);
void _timer_a0(void)
{
	ucTask_Timer5msec = 0;
#ifdef  DEBUG_UART
	UART6_TimerUp();
#endif
}

// TIMER A1			(software int 22)
#pragma interrupt	_timer_a1(vect=22)
void _timer_a1(void);
void _timer_a1(void)
{
	++Timer_1sec;
}

// TIMER A2			(software int 23)
#pragma interrupt	_timer_a2(vect=23)
void _timer_a2(void);
void _timer_a2(void){}

// TIMER A3			(software int 24)
#pragma interrupt	_timer_a3(vect=24)
void _timer_a3(void);
void _timer_a3(void){}

// TIMER A4			(software int 25)
#pragma interrupt	_timer_a4(vect=25)
void _timer_a4(void);
void _timer_a4(void){}

// timer b0			(software int 26)
#pragma interrupt	_timer_b0(vect=26)
void _timer_b0(void);
void _timer_b0(void){}

// timer b1			(software int 27)
#pragma interrupt	_timer_b1(vect=27)
void _timer_b1(void);
void _timer_b1(void){}

// timer b2			(software int 28)
#pragma interrupt	_timer_b2(vect=28)
void _timer_b2(void);
void _timer_b2(void){}

// int0				(software int 29)
#pragma interrupt	_int0(vect=29)
void _int0(void);
void _int0(void)
{
	PWR_SetWakeUpMode(PWR_WAKE_EJECT);
}

// int1				(software int 30)
#pragma interrupt	_int1(vect=30)
void _int1(void);
void _int1(void)
{
	PWR_SetWakeUpMode(PWR_WAKE_BACKUP);
	int1ic = 0x04;
}

// int2				(software int 31)
#pragma interrupt	_int2(vect=31)
void _int2(void);
void _int2(void)
{
	PWR_SetWakeUpMode(PWR_WAKE_ACC);
}

// software int 32 for user or MR30
// software int 33 for user or MR30
// software int 34 for user or MR30
// software int 35 for user or MR30
// software int 36 for user or MR30
// software int 37 for user or MR30
// software int 38 for user or MR30
// software int 39 for user or MR30
// software int 40 for user or MR30


// dma2				(software int 41)
#pragma interrupt	_dma2(vect=41)
void _dma2(void);
void _dma2(void){}

// dma3				(software int 42)
#pragma interrupt	_dma3(vect=42)
void _dma3(void);
void _dma3(void){}

// uart5  bus collision 	(software int 43)
#pragma interrupt	_uart5_buscollision(vect=43)
void _uart5_buscollision(void);
void _uart5_buscollision(void){}

// uart5  transmit		(software int 44)
#pragma interrupt	_uart5_transmit(vect=44)
void _uart5_transmit(void);
void _uart5_transmit(void){
#ifdef  AV_CONTROLLER
	AVC_TX_Interrupt();
#endif
}

// uart5  receive 		(software int 45)
#pragma interrupt	_uart5_receive(vect=45)
void _uart5_receive(void);
void _uart5_receive(void){
#ifdef  AV_CONTROLLER
	AVC_RX_Interrupt();
#endif
}

// uart6  bus collision		(software int 46)
#pragma interrupt	_uart6_buscollision(vect=46)
void _uart6_buscollision(void);
void _uart6_buscollision(void){}

// uart6  transmit 		(software int 47)
#pragma interrupt	_uart6_transmit(vect=47)
void _uart6_transmit(void);
void _uart6_transmit(void)
{
#ifdef  DEBUG_UART
	Interrupt_Uart6();
#endif
}

// uart6  receive 		(software int 48)
#pragma interrupt	_uart6_receive(vect=48)
void _uart6_receive(void);
void _uart6_receive(void)
{
#ifdef  DEBUG_UART
	Interrupt_Uart6RX();
#endif
}

// uart7  bus collision		(software int 49)
#pragma interrupt	_uart7_buscollision(vect=49)
void _uart7_buscollision(void);
void _uart7_buscollision(void){}

// uart7  transmit 		(software int 50)
#pragma interrupt	_uart7_transmit(vect=50)
void _uart7_transmit(void);
void _uart7_transmit(void)
{
#ifdef  SERIAL_FLASH
	SF_Send_Int();
#endif
}

// uart7  receive 		(software int 51)
#pragma interrupt	_uart7_receive(vect=51)
void _uart7_receive(void);
void _uart7_receive(void)
{
#ifdef  SERIAL_FLASH
	SF_Receive_Int();
#endif
}


// vector 52 reserved
// vector 53 reserved
// vector 54 reserved
// vector 55 reserved
// vector 56 reserved
// vector 57 reserved
// vector 58 reserved
// vector 59 reserved
// vector 60 reserved
// vector 61 reserved
// vector 62 reserved
// vector 63 reserved


